package 贪心;

/**
 * @ClassName _55跳跃游戏
 * @Description TODO
 * @Author 昝亚杰
 * @Date 2021/12/9 19:59
 * Version 1.0
 **/
public class _55跳跃游戏 {//贪心法    非贪心法在数组模块
    public boolean canJump(int[] nums) {
        int coverange = 0;
        for(int i = 0; i <= coverange; i++){
            coverange = i + nums[i] > coverange ? i + nums[i] : coverange;
            if(coverange >= nums.length - 1){
                return true;
            }
        }
        return false;
    }
}
